package com.dingding.nettyserver.core.listener;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

import com.dingding.nettyserver.core.server.Server;
import com.dingding.nettyserver.core.util.SpringContextHolder;

/**
 * @Description tomcat启动完成，启动Netty Server
 * @author fengshuonan
 * @date 2016年11月28日 下午1:09:11
 */
@SuppressWarnings("serial")
public class StartServerListener extends HttpServlet{

	@Override
	public void init() throws ServletException {
		Server server = SpringContextHolder.getBean(Server.class);
		server.start();
	}
	
	@Override
	public void destroy() {
		Server server = SpringContextHolder.getBean(Server.class);
		server.stop();
	}
	
}
